package com.qf.ithub.user.controller.admin;


import com.qf.ithub.common.result.R;
import com.qf.ithub.common.result.ResponseEnum;
import com.qf.ithub.user.entity.User;
import com.qf.ithub.user.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin/user")
@Api(description = "管理员使用的用户接口")
public class AdminUserController {

    @Autowired
    private UserService userService;

    /**
     *  根据id 查询user
     */
    @GetMapping("/{id}")
    @ApiOperation("根据id 查询user")
    public R<User> findUserByid(
            @PathVariable("id")
                    @ApiParam(value = "用户id",required = true)
            Integer id){

        User user = userService.findUserById(id);
        return new R(ResponseEnum.SUCCESS,user);
    }
}
